package com.tpc.control.jpa;

import java.sql.Timestamp;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * ReserveItemSale entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "reserve_item_sale", catalog = "production_control")
public class ReserveItemSale implements java.io.Serializable {

	// Fields

	private ReserveItemSaleId id;
	private ReserveItemGreige reserveItemGreige;
	private SaleData saleData;
	private ReserveItem reserveItem;
	private String remark;
	private Timestamp createDate;
	private String createBy;

	// Constructors

	/** default constructor */
	public ReserveItemSale() {
	}

	/** minimal constructor */
	public ReserveItemSale(ReserveItemSaleId id, SaleData saleData,
			ReserveItem reserveItem, Timestamp createDate, String createBy) {
		this.id = id;
		this.saleData = saleData;
		this.reserveItem = reserveItem;
		this.createDate = createDate;
		this.createBy = createBy;
	}

	/** full constructor */
	public ReserveItemSale(ReserveItemSaleId id,
			ReserveItemGreige reserveItemGreige, SaleData saleData,
			ReserveItem reserveItem, String remark, Timestamp createDate,
			String createBy) {
		this.id = id;
		this.reserveItemGreige = reserveItemGreige;
		this.saleData = saleData;
		this.reserveItem = reserveItem;
		this.remark = remark;
		this.createDate = createDate;
		this.createBy = createBy;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "reserveNo", column = @Column(name = "reserve_no", nullable = false, length = 20)),
			@AttributeOverride(name = "reserveLine", column = @Column(name = "reserve_line", nullable = false)),
			@AttributeOverride(name = "saleOrder", column = @Column(name = "sale_order", nullable = false, length = 20)),
			@AttributeOverride(name = "saleItem", column = @Column(name = "sale_item", nullable = false, length = 6)) })
	public ReserveItemSaleId getId() {
		return this.id;
	}

	public void setId(ReserveItemSaleId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "running_greige")
	public ReserveItemGreige getReserveItemGreige() {
		return this.reserveItemGreige;
	}

	public void setReserveItemGreige(ReserveItemGreige reserveItemGreige) {
		this.reserveItemGreige = reserveItemGreige;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "sale_order", referencedColumnName = "sale_order", nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "sale_item", referencedColumnName = "sale_item", nullable = false, insertable = false, updatable = false) })
	public SaleData getSaleData() {
		return this.saleData;
	}

	public void setSaleData(SaleData saleData) {
		this.saleData = saleData;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "reserve_no", referencedColumnName = "reserve_no", nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "reserve_line", referencedColumnName = "reserve_line", nullable = false, insertable = false, updatable = false) })
	public ReserveItem getReserveItem() {
		return this.reserveItem;
	}

	public void setReserveItem(ReserveItem reserveItem) {
		this.reserveItem = reserveItem;
	}

	@Column(name = "remark", length = 65535)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "create_date", nullable = false, length = 19)
	public Timestamp getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Timestamp createDate) {
		this.createDate = createDate;
	}

	@Column(name = "create_by", nullable = false, length = 20)
	public String getCreateBy() {
		return this.createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

}